package com.yonyou.iuap.shell.facade;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.yonyou.iuap.shell.pub.IShellDaoEnum;
import com.yonyou.iuap.shell.pub.IShellServiceEnum;
import com.yonyou.iuap.shell.service.impl.IndustryChartServiceImpl;
import com.yonyou.iuap.shell.service.impl.KmCommentServiceImpl;
import com.yonyou.iuap.shell.service.impl.KmSettingServiceImpl;
import com.yonyou.iuap.shell.service.impl.KnowledgeCategoryServiceImpl;
import com.yonyou.iuap.shell.service.impl.IndustrychartproductServiceImpl;
import com.yonyou.iuap.shell.service.impl.KmCategoryServiceImpl;
import com.yonyou.iuap.shell.service.impl.ProductServiceImpl;


public class IuapFacade<CompatibleServiceImpl> {
	private static IuapFacade _facade=null;
	private static ApplicationContext ctx;
	private IuapFacade(){
		
	}
	public static IuapFacade getInstance(){
		if(_facade == null){
			_facade = new IuapFacade();
			ctx = new 
	                 ClassPathXmlApplicationContext(new String[] {"classpath*:/spring/spring-*.xml"});
		}
		return _facade;
	}
	
	
	private ProductServiceImpl productServiceImpl;
	
	
	private IndustryChartServiceImpl industryChartServiceImpl;
	
	
	private KmSettingServiceImpl kmSettingImpl;
	

	public KmSettingServiceImpl getkmSettingImpl() {
		if(kmSettingImpl==null){
			kmSettingImpl = (KmSettingServiceImpl) ctx.getBean(IShellDaoEnum.Shell_Dao_Setting);
		}
		return kmSettingImpl;
	}
	public void setkmSettingImpl(KmSettingServiceImpl kmSettingImpl) {
		this.kmSettingImpl = kmSettingImpl;
	}
	public IndustryChartServiceImpl getIndustryChartServiceImpl() {
		if(industryChartServiceImpl==null){
			industryChartServiceImpl = (IndustryChartServiceImpl) ctx.getBean("service-IndustryChart");
		}
		return industryChartServiceImpl;
	}
	public void setIndustryChartServiceImpl(
			IndustryChartServiceImpl industryChartServiceImpl) {
		this.industryChartServiceImpl = industryChartServiceImpl;
	}

	private KmCommentServiceImpl kmCommentServiceImpl;
	public KmCommentServiceImpl getkmCommentServiceImpl(){
		if (kmCommentServiceImpl==null){
			kmCommentServiceImpl=(KmCommentServiceImpl)ctx.getBean(IShellServiceEnum.Shell_Service_Comment);
		}
		return kmCommentServiceImpl;
	}
	public void setKmCommentServiceImpl(KmCommentServiceImpl kmCommentServiceImpl){
		this.kmCommentServiceImpl=kmCommentServiceImpl;
	}
	

	private KnowledgeCategoryServiceImpl knowledgeCategoryServiceImpl;
	
	public KnowledgeCategoryServiceImpl getKnowledgeCategoryServiceImpl() {
		if(knowledgeCategoryServiceImpl==null){
			knowledgeCategoryServiceImpl = (KnowledgeCategoryServiceImpl) ctx.getBean("service-KnowledgeCategory");
		}
		return knowledgeCategoryServiceImpl;
	}
	public void setKnowledgeCategoryServiceImpl(
			KnowledgeCategoryServiceImpl knowledgeCategoryServiceImpl) {
		this.knowledgeCategoryServiceImpl = knowledgeCategoryServiceImpl;
	}
	

	
	public ProductServiceImpl getProductServiceImpl() {
		if(productServiceImpl==null){
			productServiceImpl = (ProductServiceImpl) ctx.getBean("service-product");
		}
		return productServiceImpl;
	}


	public void setProductServiceImpl(ProductServiceImpl productServiceImpl) {
		this.productServiceImpl = productServiceImpl;
	}
	
	
	private CompatibleServiceImpl compatibleServiceImpl;
	
	public  CompatibleServiceImpl getcompatibleServiceImpl(){
		if(compatibleServiceImpl==null){
			compatibleServiceImpl=(CompatibleServiceImpl) ctx.getBean("service-compatible");
		}
		return compatibleServiceImpl;
	}
	
	private KmCategoryServiceImpl kmCategoryServiceImpl;
	public KmCategoryServiceImpl getKmCategoryServiceImpl(){
		if(kmCategoryServiceImpl==null){
			kmCategoryServiceImpl=(KmCategoryServiceImpl)ctx.getBean("service-kmcategory");
		}
		return kmCategoryServiceImpl;
	}
	
	
	public void setCompatibleServiceImpl(CompatibleServiceImpl compatibleServiceImpl) {
		this.compatibleServiceImpl = compatibleServiceImpl;
	}
	private IndustrychartproductServiceImpl industrychartproductServiceImpl;
		
		public  CompatibleServiceImpl getindustrychartproductServiceImpl(){
			if(industrychartproductServiceImpl==null){
				industrychartproductServiceImpl=(IndustrychartproductServiceImpl) ctx.getBean("service-industrycharproduct");
			}
			return compatibleServiceImpl;
		}
		public void setIndustrychartproductServiceImpl(IndustrychartproductServiceImpl industrychartproductServiceImpl) {
			this.industrychartproductServiceImpl = industrychartproductServiceImpl;
		}
}

